<%# Copyright 2009 Swansea University

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
%>

<fieldset><legend>Code and Message</lengend>
  <p><%= f.label :code, 'Code' %> <%= f.text_field :code, :size => 5 %></p>
  <p><%= f.label :message, 'Message' %><br /><%= f.text_area :message, :rows => 10, :cols => 60, :title => "Describe this setting (textile text accepted)" %>
</p></fieldset>
<fieldset><legend>Permissions</legend>
  <h3>Define the default permissions for this setting.</h3>
  <p>Either set <%= f.label :permissions, 'numerical permissions (e.g. 76544)' %> <%= f.text_field :permissions, :size => 5, :value => '%05o' % setting.permissions %>
    <p>Or set symbolic permissions (these don't do any thing yet!):</p>
    <table>
      <thead><th>Role</th><th>Permissions</th>
      </thead>
      <tbody>
        <tr class="even">
          <td>Administrators</td>
          <td>
            R <input type="checkbox"  name="permissions[perms][]" title="Administrators have read access"    checked="checked" value="<%= 040000 %>" />
            W <input type="checkbox"  name="permissions[perms][]" title="Administrators have write access"   checked="checked" value="<%= 020000 %>" />
            X <input type="checkbox"  name="permissions[perms][]" title="Administrators have execute access" checked="checked" value="<%= 010000 %>" />
          </td>
        </tr>
        <tr class="odd">
          <td>Coordinators</td>
          <td>
            R <input type="checkbox"  name="permissions[perms][]" title="Coordinators have read access"    value="<%= 04000 %>" />
            W <input type="checkbox"  name="permissions[perms][]" title="Coordinators have write access"   value="<%= 02000 %>" />
            X <input type="checkbox"  name="permissions[perms][]" title="Coordinators have execute access" value="<%= 01000 %>" />
          </td>
        </tr>
        <tr class="even">
          <td>Staff</td>
          <td>
            R <input type="checkbox"  name="permissions[perms][]" title="Staff have read access"    value="<%= 0400 %>" />
            W <input type="checkbox"  name="permissions[perms][]" title="Staff have write access"   value="<%= 0200 %>" />
            X <input type="checkbox"  name="permissions[perms][]" title="Staff have execute access" value="<%= 0100 %>" />
          </td>
        </tr>
        <tr class="odd">
          <td>Students</td>
          <td>
            R <input type="checkbox"  name="permissions[perms][]" title="Students have read access"    value="<%= 040 %>" />
            W <input type="checkbox"  name="permissions[perms][]" title="Students have write access"   value="<%= 020 %>" />
            X <input type="checkbox"  name="permissions[perms][]" title="Students have execute access" value="<%= 010 %>" />
          </td>
        </tr>
        <tr class="even">
          <td>Others</td>
          <td>
            R <input type="checkbox"  name="permissions[perms][]" title="Others (i.e. the public) have read access"  value="4" />
            W <input type="checkbox"  name="permissions[perms][]" title="Others (i.e. the public) have write access" value="2" />
            X <input type="checkbox"  name="permissions[perms][]" title="Others (i.e. the public) have read access"  value="1" />
          </td>
        </tr>
      </tbody>
    </table>
  </p>
</fieldset>


